package org.scboy.rbac.init;

import org.scboy.coobi.sql.Coobi;
import org.scboy.coobi.sql.factory.EntityFactory;
import org.scboy.rbac.loads.loadLoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;

@Configuration
@AutoConfigureAfter(value = {Coobi.class,EntityFactory.class})
public class StartInit implements ApplicationListener<ApplicationReadyEvent> {

	Log log=LogFactory.get();
	
	@Autowired
	loadLoginUser loginUser;
	
	@Override
	public void onApplicationEvent(ApplicationReadyEvent event) {
		log.info("清理所有登录的缓存记录");
		loginUser.removeAll();
	}
}
